home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / text / hyper / ADtoHT2_1.lha / Source.lha / MyLib.lha / stdio / fclose.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-07  |  471 b   |  31 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <errno.h>
  4.  
  5. #include <proto/exec.h>
  6. #include <proto/dos.h>
  7.  
  8. /************************************************************************/
  9.  
  10. int fclose(FILE *Stream)
  11.  
  12. {
  13.   int Result;
  14.  
  15.   Result=0;
  16.   Remove((struct Node *)&Stream->Node);
  17.   if (Stream->Flags.Close)
  18.     {
  19.       if (!Close(Stream->Filehandle))
  20.     {
  21.       errno=IoErr();
  22.       Result=EOF;
  23.     }
  24.     }
  25.   if (Stream->Flags.Free)
  26.     {
  27.       free(Stream);
  28.     }
  29.   return Result;
  30. }
  31.